<template>
  <div class="page-content-container">
    <h1>Icon 图标</h1>
    <p>瑞太自用</p>
    <h2>基础用法</h2>
    <demo-block height="520">
      <template #main>
        <rticon-distribute />
        <rticon-not-handled />
        <rticon-task-distribution />
        <rticon-distribute size="40" color="red" />
        <rticon-escalation size="50" color="green" />
        <rticon-fault size="60" color="#1e90ff" />
        <rticon-vue size="70" :color="['#1e90ff', 'red']" />
        <rtmicon-home size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
        <rticon-fault size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
        <!-- 第二种写法（命名式） -->
        <rt-icon name="distribute" />
        <rt-icon name="not-handled" />
        <rt-icon name="task-distribution" />
        <rt-icon name="distribute" size="40" color="red" />
        <rt-icon name="escalation" size="50" color="green" />
        <rt-icon name="fault" size="60" color="#1e90ff" />
        <rt-icon name="vue" size="70" :color="['#1e90ff', 'red']" />
        <rt-icon name="home-m" size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
        <rt-icon name="fault" size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
      </template>
      <template #codes>
        <pre v-highlightjs>
          <code class="html">{{ codehtml }}</code>
        </pre>
        <pre v-highlightjs>
          <code class="html">{{ codehtml2 }}</code>
        </pre>
      </template>
    </demo-block>
    <h2>Attributes</h2>
    <el-table :data="attrTableData" style="width: 100%">
      <el-table-column prop="arg" label="参数" width="180">
      </el-table-column>
      <el-table-column prop="des" label="说明">
      </el-table-column>
      <el-table-column prop="type" label="类型" width="150">
      </el-table-column>
      <el-table-column prop="selector" label="可选值">
      </el-table-column>
      <el-table-column prop="default" label="默认值">
      </el-table-column>
    </el-table>
    <h2>图标集合</h2>
    <p>命名式 <el-switch v-model="usingNameMode" active-color="#13ce66" inactive-color="#ff4949" @change="onChangeMode">
      </el-switch></p>
    <el-tabs v-model="activeTab" @tab-click="handleClick">
      <el-tab-pane label="图标合集1" name="icons1">
        <IconTable />
      </el-tab-pane>
      <el-tab-pane label="图标合集2" name="icons2">
        <IconTable2 />
      </el-tab-pane>
      <el-tab-pane label="mobile" name="icons3">
        <IconTable3 />
      </el-tab-pane>
      <el-tab-pane label="logo合集" name="icons4">
        <IconTable4 />
      </el-tab-pane>
    </el-tabs>
    <div class="designer">
      <p>designed by</p>
      <img alt="lyy" :src="lyy" />
    </div>
  </div>
</template>

<script>
import IconTable from "./icon-table.vue"
import IconTable2 from "./icon-table2.vue"
import IconTable3 from "./icon-table3.vue"
import IconTable4 from "./icon-table4.vue"
import lyy from "@/assets/personIcon-lyy.jpg"

export default {
  components: {
    IconTable, IconTable2, IconTable3, IconTable4
  },
  data() {
    return {
      codehtml: `        <rticon-distribute />
        <rticon-not-handled />
        <rticon-task-distribution />
        <rticon-distribute size="40" color="red" />
        <rticon-escalation size="50" color="green" />
        <rticon-fault size="60" color="#1e90ff" />
        <rticon-vue size="70" :color="['#1e90ff', 'red']" />
        <!-- 渐变色 -->
        <rticon-add-item size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
        <rticon-escalation size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />`,
      codehtml2: `        <!-- 第二种写法 -->
        <rt-icon name="distribute" />
        <rt-icon name="not-handled" />
        <rt-icon name="task-distribution" />
        <rt-icon name="distribute" size="40" color="red" />
        <rt-icon name="escalation" size="50" color="green" />
        <rt-icon name="fault" size="60" color="#1e90ff" />
        <rt-icon name="vue" size="70" :color="['#1e90ff', 'red']" />
        <rt-icon name="home-m" size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />
        <rt-icon name="fault" size="60" :gradient-position="['100%', '100%', '0%', '0%']"
          :linear-gradient="[['0%', 'rgb(255, 255, 0)'], ['50%', 'rgb(255, 0, 0)'], ['100%', 'rgb(0, 0, 0)']]" />`,
      attrTableData: [
        {
          arg: 'size',
          des: '尺寸',
          type: 'Number/String',
          selector: ' — ',
          default: '30'
        },
        {
          arg: 'color',
          des: '图标颜色',
          type: 'String',
          selector: ' — ',
          default: '#000'
        },
        {
          arg: 'linear-gradient',
          des: '渐变色色值及变色位置信息 [ x1, y1, x2, y2 ]',
          type: 'String[]',
          selector: ' — ',
          default: ' — '
        },
        {
          arg: 'gradient-position',
          des: '渐变色点位方向信息 [ ...[ position, color ] ]',
          type: 'Array[]',
          selector: ' — ',
          default: ' — '
        }
      ],
      activeTab: 'icons1',
      lyy,
      usingNameMode: this.$store.state.usingIconNameMode,
    }
  },
  methods: {
    handleClick(x) {
      // console.log(x)
    },
    onChangeMode(mode) {
      this.$store.commit("changeIconMode", mode)
    }
  }
}

</script>


<style scoped>
p {
  font-size: 15px;
}

.designer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.designer img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 10px;
}
</style>